﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AutoUpdate.Helper
{
    public class FileHelper
    {
        /// <summary>
        /// 获取文件目录下所有文件《全路径》
        /// </summary>
        /// <param name="path">文件夹路径</param>
        /// <returns></returns>
        public static void GetFiles(string path, List<string> lstFiles)
        {
            try
            {
                FileInfo[] files = new DirectoryInfo(path).GetFiles();
                foreach (var f in files)
                {
                    lstFiles.Add(f.FullName);
                }
                DirectoryInfo[] dirs = new DirectoryInfo(path).GetDirectories();
                foreach (var d in dirs)
                {
                    //跳过Log文件夹防止覆盖本地Log文件
                    if (d.Name != "Log")
                    {
                        GetFiles(d.FullName, lstFiles);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
    }
}
